<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <script src="js/jquery.min.js"></script>
    <title>主页</title>
</head>

<body>
    <h3>主页</h3>
    <div>
        <span id="username"></span>
    </div>
</body>

    <script>
        //获取用户信息
        function getUserInfo() {
            jQuery.ajax({
                type: "GET",
                url: "/user/show",
                data:{},
                success: function(result) {
                    if(result != null && result.code == 200 && result.data != null) {
                        var username = jQuery("#username");
                        username.text("欢迎回来:" + result.data);
                    } else {
                        alert("用户信息获取失败!");
                    }
                }
            });
        }
        getUserInfo();
    </script>

</html>